IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'CreatorAdd')
	BEGIN
		DROP  Procedure  CreatorAdd
	END

GO

CREATE Procedure CreatorAdd
@UserName varchar(50),
@ApplicationName varchar(256) 
AS
Declare @ApplicationID uniqueidentifier 
Select @ApplicationID = ApplicationID From aspnet_Applications Where ApplicationName = @ApplicationName

Declare @UserID uniqueidentifier 
Select  @UserID = UserID From aspnet_Users Where ApplicationID = @ApplicationID and USerName =  @UserName

Insert Into Creator
(UserID,CanAdd,IsBrowser)
Values
(@UserId,1,0)

GO



